
<!DOCTYPE html>
<html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>任务管理</title>
    <link href="../../web-frame/ruoyi/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../../web-frame/ruoyi/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../../web-frame/ruoyi/libs/bootstrap-table/bootstrap-table.min.css?v=20201129" rel="stylesheet"/>
    <link href="../../web-frame/ruoyi/css/animate.css" rel="stylesheet"/>
    <link href="../../web-frame/ruoyi/css/style.css?v=20200903" rel="stylesheet"/>
    <link href="../../web-frame/ruoyi/ruoyi/css/ry-ui.css?v=4.6.0" rel="stylesheet"/>

</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="role-form">
                <div class="col-sm-12 search-collapse">
                    <form id="menu-form">
                        <div class="select-list">
                            <ul>
                                <li>
                                    标题名称：<input type="text" name="menuName"/>
                                </li>
                                <li>
                                    <div id="list-type"></div>
                                </li>
                                <li>
                                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                </li>
                            </ul>
                        </div>
                    </form>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" id="addtitle">
                <i class="fa fa-plus"></i> 类型新增
            </a>
            <a class="btn btn-primary" onclick="$.operate.edit()">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-info" id="expandAllBtn">
                <i class="fa fa-exchange"></i> 展开/折叠
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>

<a id="scroll-up" href="#" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
<script src="../../web-frame/ruoyi/js/jquery.min.js"></script>
<script src="../../web-frame/ruoyi/js/bootstrap.min.js"></script>
<!-- bootstrap-table 表格插件 -->
<script src="../../web-frame/ruoyi/libs/bootstrap-table/bootstrap-table.min.js?v=20201129"></script>
<script src="../../web-frame/ruoyi/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20201129"></script>
<script src="../../web-frame/ruoyi/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js?v=20201129"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="../../web-frame/ruoyi/libs/validate/jquery.validate.min.js"></script>
<script src="../../web-frame/ruoyi/libs/validate/messages_zh.min.js"></script>
<script src="../../web-frame/ruoyi/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="../../web-frame/ruoyi/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<!-- 遮罩层 -->
<script src="../../web-frame/ruoyi/libs/blockUI/jquery.blockUI.js"></script>
<script src="../../web-frame/ruoyi/libs/iCheck/icheck.min.js"></script>
<script src="../../web-frame/ruoyi/libs/layer/layer.min.js"></script>
<script src="../../web-frame/ruoyi/libs/layui/layui.js"></script>
<script src="../../web-frame/ruoyi/ruoyi/js/common.js?v=4.6.0"></script>
<script src="../../web-frame/ruoyi/ruoyi/js/ry-ui.js?v=4.6.0"></script>

<script class="addtype" type="text/html">
    <div class="form-group">
        <input type="text" placeholder="请输入类型名称" id="typename" class="form-control">
    </div>
</script>

<script>


    $(function() {
        var options = {
            url: "/note/noteList",
            modalName: "角色",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '唯一编号'
                },
                {
                    field: 'title',
                    title: '标题'
                }
               ]
        };
        $.table.init(options);
        gettypelist()
    });

    $("#addtitle").click(function () {
        layer.open({
            content: $('.addtype').html()
            ,area: ['400px', '200'] //自定义文本域宽高
            ,title:'类型新增'
            ,btn: ['确定', '取消']
            ,yes: function(){
                var typename=$("#typename").val();
                var data=urldata('put','/notetype',{'type':typename})
                if(data.code==0){
                    layer.msg("添加成功")
                }else {
                    layer.open({
                        title: '提示',
                        icon: '1',
                        content:"添加成功",
                        time:3000,
                        end:function(){
                            parent.layer.closeAll();
                        }
                    });
                }
            }
            ,btn2: function(){
                //按钮【取消】的回调
                return 0;
            }
        });
    })

    function gettypelist() {
        var data=urldata('get','/notetype','')
        var str=' 菜单状态：<select name="visible">'
        str+='<option value="0">无</option>'
        for(var i= 0; i < data.data.length ; i++) {
            str+='<option value='+data.data[i].key+'>'+data.data[i].value+'</option>'
        }
        str+='</select>'
        $("#list-type").html(str)
    }

    function urldata(requestObject,url,data) {
        var data1='';
        $.ajax({
            type: requestObject,
            url: url,
            data:data,
            async:false,
            success: function(data) {
                data1=data;
            }
        })
        return data1
    }

</script>
</body>
</html>